/*
 * leds.c
 *
 *  Created on: Feb 26, 2013
 *      Author: ostan
 */

#include <avr/io.h>

void LED_init(void) {
	DDRB |= 1<<DDB0 | 1<<DDB2; // initialize PB0 and PB2 as outputs
}

void LED_on(uint8_t led) {
	switch (led) {
	case 0:
		PORTB &= ~(1<<PB0);
		break;
	case 1:
		PORTB &= ~(1<<PB2);
		break;
	}
}

void LED_off(uint8_t led) {
	switch (led) {
	case 0:
		PORTB |= (1<<PB0);
		break;
	case 1:
		PORTB |= (1<<PB2);
		break;
	}
}

void LED_toggle(uint8_t led) {
	switch (led) {
	case 0:
		PORTB ^= (1<<PB0);
		break;
	case 1:
		PORTB ^= (1<<PB2);
		break;
	}
}
